<template>
	<view>
		<home :cur="PageCur" v-if="PageCur=='home'" :key="commponent1Key"></home>
		<funcList v-if="PageCur=='funcList'" :key="commponent2Key"></funcList>
		<people v-if="PageCur=='people'" :key="commponent3Key"></people>
		<view class="cu-bar tabbar bg-white shadow foot">
			<view :class="PageCur=='home'?'action text-green':'action text-gray'" @click="NavChange" data-cur="home">
				<view class='cuIcon-homefill'></view>首页
			</view>
			<view :class="PageCur=='funcList'?'action text-green':'action text-gray'" @click="NavChange" data-cur="funcList">
				<view class='cuIcon-list'></view>应用
			</view>
			<!-- <view :class="PageCur=='peoplelis'?'action text-green':'action text-gray'" @click="scanCode" data-cur="peoplelis">
				<view class='cuIcon-scan'></view>扫描
			</view> -->
			<!-- <view :class="PageCur=='profile'?'action text-green':'action text-gray'" @click="NavChange" data-cur="profile">
				<view class='cuIcon-profile'></view>发起
			</view> -->
			<view :class="PageCur=='people'?'action text-green':'action text-gray'" @click="NavChange" data-cur="people">
				<view class='cuIcon-people'></view>我的
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
		return {
				PageCur: 'home',
				commponent1Key: 0,
				commponent2Key: 0,
				commponent3Key: 0,
			}
		},
		onLoad:function(){
			this.PageCur='home'
			++this.commponent1Key
			++this.commponent2Key
			++this.commponent3Key
			this.getSysPara()
		},
		methods: {
			NavChange: function(e) {
				this.PageCur = e.currentTarget.dataset.cur
			},
			getSysPara(){
				let url = '/dcloud/sysPara/sysPara/list'
				let that = this
				this.$http.get(url, {
					params: {
						para:"industry",
					}
				}).then(res => {
					if (res.data.success) {
						let industry = res.data.result.records[0].value
						if (industry == 'afs' || industry == 'AFS'){
							uni.setStorageSync('industry','afs')
						} else {
							uni.setStorageSync('industry','nafs')
						}
					}
				}).catch(err => {
					console.log(err);
				});
			}

		}
	}
</script>

<style>

</style>
